package day5.string;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: watermelon
 * Date: 2025-05-31
 * Time: 10:20
 */

public class Main {
    public static boolean ispalindrome(String Str)
    {
        Str=Str.toLowerCase();
        int left=0,right=Str.length()-1;
        while (left<right)
        {
            while(left<right&&!isnumberorchar(Str.charAt(left)))
            {
                left++;
            }
            while(left<right&&!isnumberorchar(Str.charAt(right)))
            {
                right--;
            }
            if(Str.charAt(left)==Str.charAt(right))
            {
                left++;
                right--;
            }
            else
            {
                return false;
            }
        }
        return true;
    }
    public static boolean isnumberorchar(char ch)
    {
        if(Character.isDigit(ch)||Character.isLetter(ch))
        {
            return true;
        }
        else {
            return false;
        }
    }
    public static int firstuniquechar(String str)
    {
        int[]charr=new int[26];
        for (int i = 0; i <str.length() ; i++) {
            charr[str.charAt(i)-'a']++;
        }

        for (int j = 0; j < str.length(); j++) {
            if(charr[str.charAt(j)-'a']==1)
            {
                return j;
            }
        }
        return -1;
    }
    public static void main(String[] args) {
        StringBuilder ST2=new StringBuilder("ADASD");
        ST2.insert(2,"adas");
        System.out.println(ST2);
    }
}
